import { Component } from 'react';
import { LockOutlined, UserOutlined } from '@ant-design/icons';
import { Link } from 'react-router-dom'
import { Button, Form, Input } from 'antd';
import '../../css/login/login.scss'
const onFinish = (values) => {
    console.log('Success:', values);

};
const onFinishFailed = (errorInfo) => {
    console.log('Failed:', errorInfo);
    // this.props.history.push('/home')
};
class Login extends Component {
    render() {
        return (
            <div className='app'>
                <div className='from'>
                    <Form
                        name="basic"
                        labelCol={{
                            span: 8,
                        }}
                        wrapperCol={{
                            span: 16,
                        }}
                        style={{
                            maxWidth: 600,
                        }}
                        initialValues={{
                            remember: true,
                        }}
                        onFinish={onFinish}
                        onFinishFailed={onFinishFailed}
                        autoComplete="off"
                    >
                        <Form.Item
                            name="username"
                            rules={[
                                {
                                    required: true,
                                    message: '请输入正确的用户',
                                },
                            ]}
                        >
                            <Input prefix={<UserOutlined className="site-form-item-icon" />} className='username' placeholder="请输入账号" />
                        </Form.Item>

                        <Form.Item
                            name="password"
                            rules={[
                                {
                                    required: true,
                                    message: '密码长度不能少于6位',
                                },
                            ]}
                        >
                            <Input.Password prefix={<LockOutlined className="site-form-item-icon" />} className='password' placeholder="请输入密码" />
                        </Form.Item>

                        <Form.Item>
                            <Link to="/index/home">
                                <Button type="primary" htmlType="submit" style={{ width: 348, height: 40 }}>
                                    登录
                                </Button>
                            </Link>
                        </Form.Item>
                    </Form>
                </div>
            </div>

        );
    }
}

export default Login;
